<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>添加销售价格单</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../../../../elementUI/index.css">
  <link rel="stylesheet" href="../../../../css/index.css">
</head>

<body>
  <div id="app" class="minWidth">
    <el-form :model="form" ref="contract" :rules="rules" inline-message="true" style="width: 100%">
      <div class="table_titel">
        <div class="titel">销售价格单</div>
      </div>
      <el-descriptions :column="4" border size="small">
        </el-descriptions-item>
        <el-descriptions-item label="开始时间">
          <el-form-item prop="Start_Date">
            <el-date-picker v-model.trim="form.Start_Date" type="datetime" placeholder="请选择开始时间"
              value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="结算时间">
          <el-form-item prop="End_Date">
            <el-date-picker v-model.trim="form.End_Date" type="datetime" placeholder="请选择结算时间"
              value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="补货时间默认00:00:00">
          <el-form-item prop="always">
            <el-time-picker v-model.trim="always" arrow-control placeholder="请选择补货时间默认00:00:00"
              value-format="HH:mm:ss"></el-date-picker>
          </el-form-item>
        </el-descriptions-item>
      </el-descriptions>

      <div class="table_titel">
        <div class="titel">销售价格单明细</div>
        <div class="operation">
          <el-button type="primary" size="small" @click="add_sales_unitprice_detail">新增</el-button>
          <el-button type="danger" size="small" @click="remove_sales_unitprice_detail">删除</el-button>
        </div>
      </div>
      <el-descriptions :column="2" border size="small" v-for="(item,index) in form.Children.sales_unitprice_detail"
        :key="index">
        <el-descriptions-item label="商品编号">
          <el-form-item>
            <el-select v-model.trim="item.Article_SerialNumber" placeholder="请选择商品" filterable
              @change="Change_Unit_Price(index)" style="width: 100%">
              <el-option v-for="(item,index) in shop" :key="index" :label="item.Article_Name"
                :value="item.Article_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="商品规格">
          <el-form-item>
            <el-select :disabled="isDisabled" v-model.trim="item.Article_Specifications_SerialNumber"
              placeholder="请选择规格" filterable @change="Change_Specifications_Name(index)" style="width: 100%">
              <el-option v-for="(item,index) in item.specs" :key="item.Article_Specifications_SerialNumber"
                :label="item.Specifications_Name" :value="item.Article_Specifications_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="零售价">
          <el-form-item>
            <el-input v-model.trim="item.Unit_Price" disabled placeholder="零售价"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="净含量">
          <el-form-item>
            <el-input v-model.trim="item.Net_Content" disabled placeholder="净含量"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="销售单价">
          <el-form-item>
            <el-input v-model.trim="item.Sales_Unit_Price" placeholder="请输入销售单价"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="有/无货货主">
          <el-form-item>
            <el-radio-group v-model="item.Sign">
              <el-radio label="无货货主" value="0"></el-radio>
              <el-radio label="有货货主" value="1"></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="分配数量">
          <el-form-item>
            <el-input v-model.trim="item.Distribute" placeholder="请输入分配数量"></el-input>
          </el-form-item>
        </el-descriptions-item>
      </el-descriptions>


      <div class="table_titel">
        <div class="titel">适用店铺</div>
        <div class="operation">
          <el-button type="primary" size="small" @click="add_sales_unitprice_storescope">新增</el-button>
          <el-button type="danger" size="small" @click="remove_sales_unitprice_storescope">删除</el-button>
        </div>
      </div>
      <el-descriptions :column="2" :rules="rules" border size="small"
        v-for="(item,index) in form.Children.sales_unitprice_storescope" :key="index">
        <el-descriptions-item label="门店流水号">
          <el-form-item prop="Store_SerialNumber">
            <el-select v-model.trim="item.Store_SerialNumber" placeholder="请选择店铺" filterable style="width: 100%">
              <el-option v-for="(item,index) in store" :key="index" :label="item.Store_Name"
                :value="item.Store_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
      </el-descriptions>
      <div style="margin-bottom: 100px;">
        <div class="table_titel">
          <div class="titel">所属栏目</div>
          <div class="operation">
            <el-button type="primary" size="small" @click="add_sales_unitprice_column">新增</el-button>
            <el-button type="danger" size="small" @click="remove_sales_unitprice_column">删除</el-button>
          </div>
        </div>
        <el-descriptions :column="2" :rules="rules" border size="small"
          v-for="(item,index) in form.Children.sales_unitprice_column" :key="index">
          <el-descriptions-item label="所属栏目">
            <el-form-item prop="ShopColumn_Id">
              <el-select v-model.trim="item.ShopColumn_Id" placeholder="请选择栏目" filterable style="width: 100%">
                <el-option-group v-for="(group,index) in column" :key="index" :label="group.label">
                  <el-option v-for="(item,index) in group.options" :key="index" :label="item.name"
                    :value="item.ShopColumn_Id"></el-option>
                </el-option-group>
              </el-select>
            </el-form-item>
          </el-descriptions-item>
        </el-descriptions>
      </div>
      <el-form-item class="form-operation">
        <el-button @click="window.history.back()">返回</el-button>
        <el-button type="success" @click="onExcel">导入</el-button>
        <el-button type="primary" :loading="loading" @click="submitForm('contract')">提交</el-button>
      </el-form-item>
    </el-form>
    <el-dialog :visible.sync="dialogVisible">
      <div class="table_titel">
        <div class="titel">导入表格</div>
      </div>
      <el-date-picker v-model.trim="Start_Date" type="datetime" placeholder="请选择开始时间" format="yyyy 年 MM 月 dd 日"
        value-format="yyyy-MM-dd"></el-date-picker>
      <el-date-picker v-model.trim="End_Date" type="datetime" placeholder="请选择结束时间" format="yyyy 年 MM 月 dd 日"
        value-format="yyyy-MM-dd"></el-date-picker>
      <el-select multiple v-model.trim="Store_SerialNumber" placeholder="请选择店铺" filterable style="width: 100%">
        <el-option v-for="(item,index) in store" :key="index" :label="item.Store_Name"
          :value="item.Store_SerialNumber"></el-option>
      </el-select>
      <el-upload id="Excel" class="upload-demo" action="" :before-remove="beforeRemove" :file-list="fileList"
        :before-upload="uploadDetails">
        <el-button size="small" type="primary" v-show="fileList.length<1">导入</el-button>
        <div slot="tip" class="el-upload__tip" v-show="fileList.length<1">请上传xlsx表格</div>
      </el-upload>
      <el-button size="small" type="primary" :loading="loading" @click="submitForm1">点击上传</el-button>
    </el-dialog>
  </div>
  <script type="text/javascript" src="../../../../js/jquery-3.6.0.min.js"></script>
  <script type="text/javascript" src="../../../../js/jquery.cookie.js"></script>
  <script type="text/javascript" src="../../../../js/vue.min.js"></script>
  <script type="text/javascript" src="../../../../elementUI/index.js"></script>
  <script type="text/javascript" src="../../../../js/utils.js"></script>
  <script type="text/javascript" src="../../../../js/ID_Validity.js"></script>
  <script type="text/javascript" src="../../../../js/FileSaver.min.js"></script>
  <script type="text/javascript" src="../../../../js/FileSaver.js"></script>
  <script type="text/javascript" src="../../../../js/xlsx.full.min.js"></script>
  <script type="text/javascript" src="./js/Edit.js"></script>
</body>

</html>